57b94fda95788829a2beb0c3dde71ca4addb2d97,perspective-worker/src/main/java/org/meridor/perspective/worker/processor/InstancesProcessor.java,InstancesProcessor,processInstances,#InstanceEvent#,43

Before Change


                    event.getInstance().getId(),
                    event.getClass().getSimpleName()
            );
            Yatomata<InstanceFSM> fsm = fsmBuilderAware.get(InstanceFSM.class).build();
            fsm.fire(event);
        } else {
            LOG.debug(

After Change


    private void processInstances(InstanceEvent event) {
        Instance instanceFromEvent = event.getInstance();
        Optional<Instance> instanceOrEmpty = instancesAware.getInstance(instanceFromEvent.getId());
        InstanceFSM fsmInstance = applicationContext.getBean(InstanceFSM.class);
        if (instanceOrEmpty.isPresent()) {
            Instance instance = instanceOrEmpty.get();
            InstanceEvent currentState = instanceToEvent(instance);
            Yatomata<InstanceFSM> fsm = new FSMBuilder<>(fsmInstance).build(currentState);
            LOG.debug(
                    "Updating instance {} ({}) from state = {} to state = {}",
                    instance.getName(),